<template>
  <div class="container">
    <h3 align="center">南京科技职业学院简介</h3>
    <p v-for="(paragraph, index) in paragraphs" :key="index" class="p-item">
      {{ filteHtmlTag(paragraph) }}
    </p>
  </div>
</template>

<script>
import { timeSelectProps } from 'element-plus'
export default {
  data() {
    return {
      content: '',
      paragraphs: [],
    }
  },
  created() {
    fetch('/api/17/list.htm')
      .then((res) => {
        return res.text()
      })
      .then((res) => {
        this.content = res
        const index = this.content.indexOf('南京科技职业学院是江苏省人民政府举办')
        this.content = this.content.substring(index)
        const indexEnd = this.content.indexOf('贡献！')

        this.content = this.content.substring(0, indexEnd + 3)

        this.paragraphs = this.content.split(
          '</p><p class="p_text_indent_2 wp_editor_art_paste_p" style="line-height:1.75em;font-size:18px;">'
        )
      })
  },
  methods: {
    filteHtmlTag(str) {
      return str.replace(/<[^>]*>/g, '');
    },
  },
}
</script>

<style lang="scss" scoped>
.container {
  padding: 20px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}
.p-item {
  padding: 0px;
  text-indent: 2pc;
  margin: 0;
  font-size: 20px;
  line-height: 40px;
}
</style>
